home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / movecurs / moveit.frm (.txt) < prev   
Encoding:
Visual Basic Form  |  1995-09-06  |  3.5 KB  |  110 lines

  1. VERSION 2.00
  2. Begin Form moveit 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Cursor Position Example"
  5.    ClientHeight    =   6120
  6.    ClientLeft      =   1680
  7.    ClientTop       =   1605
  8.    ClientWidth     =   7245
  9.    Height          =   6525
  10.    Left            =   1620
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   6120
  15.    ScaleWidth      =   7245
  16.    Top             =   1260
  17.    Width           =   7365
  18.    Begin CommandButton Command4 
  19.       Caption         =   "Command4"
  20.       Height          =   525
  21.       Left            =   5490
  22.       TabIndex        =   3
  23.       Top             =   480
  24.       Width           =   1245
  25.    End
  26.    Begin CommandButton Command3 
  27.       Caption         =   "Command3"
  28.       Height          =   525
  29.       Left            =   5490
  30.       TabIndex        =   2
  31.       Top             =   5070
  32.       Width           =   1245
  33.    End
  34.    Begin CommandButton Command2 
  35.       Caption         =   "Command2"
  36.       Height          =   525
  37.       Left            =   540
  38.       TabIndex        =   1
  39.       Top             =   5070
  40.       Width           =   1245
  41.    End
  42.    Begin CommandButton Command1 
  43.       Caption         =   "Command1"
  44.       Height          =   525
  45.       Left            =   540
  46.       TabIndex        =   0
  47.       Top             =   480
  48.       Width           =   1245
  49.    End
  50. Declare Sub ClientToScreen Lib "User" (ByVal hWnd As Integer, lpPoint As POINTAPI)
  51. Declare Sub SetCursorPos Lib "User" (ByVal X As Integer, ByVal Y As Integer)
  52. Sub Command1_Click ()
  53.  Dim P As POINTAPI
  54.  SaveMode% = Me.ScaleMode
  55.  Me.ScaleMode = 3
  56.  P.X = Command2.Left + (Command2.Width) / 2
  57.  P.Y = Command2.Top + (Command2.Height) / 2
  58.  ClientToScreen Me.hWnd, P
  59.  SetCursorPos P.X, P.Y
  60.  Me.ScaleMode = SaveMode%
  61. End Sub
  62. Sub Command2_Click ()
  63.  Dim P As POINTAPI
  64.  SaveMode% = Me.ScaleMode
  65.  Me.ScaleMode = 3
  66.  P.X = Command3.Left + (Command3.Width) / 2
  67.  P.Y = Command3.Top + (Command3.Height) / 2
  68.  ClientToScreen Me.hWnd, P
  69.  SetCursorPos P.X, P.Y
  70.  Me.ScaleMode = SaveMode%
  71. End Sub
  72. Sub Command3_Click ()
  73.  Dim P As POINTAPI
  74.  SaveMode% = Me.ScaleMode
  75.  Me.ScaleMode = 3
  76.  P.X = Command4.Left + (Command4.Width) / 2
  77.  P.Y = Command4.Top + (Command4.Height) / 2
  78.  ClientToScreen Me.hWnd, P
  79.  SetCursorPos P.X, P.Y
  80.  Me.ScaleMode = SaveMode%
  81. End Sub
  82. Sub Command4_Click ()
  83.  Dim P As POINTAPI
  84.  SaveMode% = Me.ScaleMode
  85.  Me.ScaleMode = 3
  86.  P.X = Command1.Left + (Command1.Width) / 2
  87.  P.Y = Command1.Top + (Command1.Height) / 2
  88.  ClientToScreen Me.hWnd, P
  89.  SetCursorPos P.X, P.Y
  90.  Me.ScaleMode = SaveMode%
  91. End Sub
  92. Sub Form_Load ()
  93.  Dim Msg
  94.  Beep
  95.  Msg = "                Cursor Position Example" + Chr$(13)
  96.  Msg = Msg & "                 1993 by Mark Wisecarver" + Chr$(13) + Chr$(10)
  97.  Msg = Msg & Chr$(10) + "This will show you how to position" + Chr$(13)
  98.  Msg = Msg & Chr$(10) + "the cursor on your apps using API declarations." + Chr$(13) + Chr$(10)
  99.  Msg = Msg & Chr$(10) + "I can be reached via FrontDoor at 1:2380/410.0" + Chr$(13)
  100.  Msg = Msg & Chr$(10) + "or on CompuServe at 72400,505." + Chr$(13)
  101.  Msg = Msg & Chr$(10) + "________________________________________" + Chr$(13) + Chr$(10)
  102.  Msg = Msg & Chr$(10) + "The Visual Basic Depot, Mark Wisecarver" + Chr$(13)
  103.  Msg = Msg & Chr$(10) + "Flatrock, Michigan U.S.A." + Chr$(13)
  104.  MsgBox Msg
  105.   If WindowState = 0 Then
  106.     Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
  107.   End If
  108.   Show
  109. End Sub
  110.